//
//  MyOverlay.swift
//  SwiftUIImage
//
//  Created by 李煜 on 2024/7/30.
//

import SwiftUI

struct MyOverlay: View {
    var body: some View {
        Image("paris")
            .resizable()
            .aspectRatio(contentMode: .fit)
			//对齐顶部
            .overlay(alignment: .top) {
                Text("If you are lucky enough to have lived in Paris as a young man, then wherever you go for the rest of your life it stays with you, for Paris is a moveable feast.\n\n- Ernest Hemingway")
                    .fontWeight(.heavy)
                    .font(.system(.headline, design: .rounded))
                    .foregroundStyle(.white)
                    .padding()
                    .background(.black)
                    .cornerRadius(10)
                    .opacity(0.8)
                    .padding()
            }
			
    }
}

#Preview {
    MyOverlay()
}
